package com.ruoyi.pingjiao.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.pingjiao.domain.PaperItem;
import com.ruoyi.pingjiao.mapper.PaperItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pingjiao.mapper.PaperItemCategoryMapper;
import com.ruoyi.pingjiao.domain.PaperItemCategory;
import com.ruoyi.pingjiao.service.IPaperItemCategoryService;

/**
 * 评教问卷类管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-10-22
 */
@Service
public class PaperItemCategoryServiceImpl implements IPaperItemCategoryService 
{
    @Autowired
    private PaperItemCategoryMapper paperItemCategoryMapper;
    @Autowired
    private PaperItemMapper paperItemMapper;
    /**
     * 查询评教问卷类管理
     * 
     * @param paperItemCategoryId 评教问卷类管理主键
     * @return 评教问卷类管理
     */
    @Override
    public PaperItemCategory selectPaperItemCategoryByPaperItemCategoryId(Long paperItemCategoryId)
    {
        return paperItemCategoryMapper.selectPaperItemCategoryByPaperItemCategoryId(paperItemCategoryId);
    }

    /**
     * 查询评教问卷类管理列表
     * 
     * @param paperItemCategory 评教问卷类管理
     * @return 评教问卷类管理
     */
    @Override
    public List<PaperItemCategory> selectPaperItemCategoryList(PaperItemCategory paperItemCategory)
    {
        return paperItemCategoryMapper.selectPaperItemCategoryList(paperItemCategory);
    }

    /**
     * 新增评教问卷类管理
     * 
     * @param paperItemCategory 评教问卷类管理
     * @return 结果
     */
    @Override
    public PaperItemCategory insertPaperItemCategory(PaperItemCategory paperItemCategory)
    {
        paperItemCategory.setCreateTime(DateUtils.getNowDate());
        int i = paperItemCategoryMapper.insertPaperItemCategory(paperItemCategory);
        return paperItemCategory;
    }

    /**
     * 修改评教问卷类管理
     * 
     * @param paperItemCategory 评教问卷类管理
     * @return 结果
     */
    @Override
    public int updatePaperItemCategory(PaperItemCategory paperItemCategory)
    {
        paperItemCategory.setUpdateTime(DateUtils.getNowDate());
        return paperItemCategoryMapper.updatePaperItemCategory(paperItemCategory);
    }

    /**
     * 批量删除评教问卷类管理
     * 
     * @param paperItemCategoryIds 需要删除的评教问卷类管理主键
     * @return 结果
     */
    @Override
    public int deletePaperItemCategoryByPaperItemCategoryIds(Long[] paperItemCategoryIds)
    {
        return paperItemCategoryMapper.deletePaperItemCategoryByPaperItemCategoryIds(paperItemCategoryIds);
    }

    /**
     * 删除评教问卷类管理信息
     * 
     * @param paperItemCategoryId 评教问卷类管理主键
     * @return 结果
     */
    @Override
    public int deletePaperItemCategoryByPaperItemCategoryId(Long paperItemCategoryId)
    {
        return paperItemCategoryMapper.deletePaperItemCategoryByPaperItemCategoryId(paperItemCategoryId);
    }

    @Override
    public Object selectPaperItemByPaperItemCategoryName(String paperItemCategoryName) {
        Long paperItemCategoryId= paperItemCategoryMapper.selectPaperItemCategoryIdByPaperItemCategoryName(paperItemCategoryName);
        List<PaperItem>list= paperItemMapper.selectPaperItemByPaperItemCategoryId(paperItemCategoryId);
        return list;
    }
}
